public class a04demo4 {
    public static void main(String[] args) {

        System.out.println(fib(20));
    }

    public static int fib(int n) {
        if (n == 1) {
            return 1;
        }
        else if (n == 2) {
            return 2;
        }
        else if(n==3){
            return 4;
        }
        return fib(n - 1) + fib(n - 2)+fib(n-3);
    }

}
